package com.atguigu.map;

import java.util.Properties;
import java.util.Set;

/**
 * @program: IDEAcode
 * @description:Properties存储方法
 * @author: Mr.zjx
 * create: 2021-08-16-16-31
 **/
public class PropertiesTest {
    public static void main(String[] args) {
        //创集合对象，不要多态
        Properties properties = new Properties();
        properties.setProperty("name","zhangsan");
        properties.setProperty("age","20");
        properties.setProperty("address","shenzhenshi");
        String value = properties.getProperty("age");
        System.out.println("value = " + value);
        System.out.println("properties = " + properties);
        //存储到set集合
        Set<String> set = properties.stringPropertyNames();
        for(String key:set){
            String property = properties.getProperty(key);
            System.out.println(key+"="+property);
        }
    }
}
